package vg.main;

import com.almworks.sqlite4java.SQLite;
import vg.modules.attribute_panel.AttributePlugin;
import vg.modules.backlight.PathSelectingPlugin;
import vg.modules.desktop.DesktopPlugin;
import vg.modules.exporters.GraphMLExporterPlugin;
import vg.modules.filter.FilterPlugin;
import vg.modules.graph_comparison.GraphComparisonPlugin;
import vg.modules.layout.GraphLayoutPlugin;
import vg.modules.graph_settings.GraphSettingsPlugin;
import vg.modules.help.about.AboutPlugin;
import vg.modules.minimap.MiniMapPlugin;
import vg.modules.navigator.NavigatorPlugin;
import vg.modules.notepad.NotepadPlugin;
import vg.modules.opener.GUIOpener;
import vg.modules.zoom.ZoomPlugin;
import vg.modules.search.SearchPlugin;
import vg.modules.tab_closer.SimpleTabCloser;
import vg.modules.util_plugins.LookAndFeelChanger;
import vg.modules.util_plugins.PanningButtonPlugin;
import vg.modules.util_plugins.UndoRedoButtonPlugin;
import vg.services.main_manager.MainManager;

import javax.swing.*;

/**
 * Enter point.
 *
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class Main {
	public static void main(String[] args) {
        // execute initial preparations
        MainManager.executeInitialPreparations();

        // configurable decoders from program
        MainManager.logger.enableDebugMessage(true);

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    new GUIOpener().install(MainManager.pluginParameter);
                    new SimpleTabCloser(MainManager.pluginParameter.userInterfaceManager);

                    new GraphLayoutPlugin().install(MainManager.pluginParameter);
                    new DesktopPlugin().install(MainManager.pluginParameter);
                    new FilterPlugin().install(MainManager.pluginParameter);
                    new UndoRedoButtonPlugin().install(MainManager.pluginParameter);
                    new SearchPlugin().install(MainManager.pluginParameter);
                    new GraphSettingsPlugin().install(MainManager.pluginParameter);
                    new LookAndFeelChanger().install(MainManager.pluginParameter);
                    new NotepadPlugin().install(MainManager.pluginParameter);
                    new PathSelectingPlugin().install(MainManager.pluginParameter);
                    new AttributePlugin().install(MainManager.pluginParameter);
                    //new StorablePlugin().install(MainManager.pluginParameter);
                    new ZoomPlugin().install(MainManager.pluginParameter);
                    new MiniMapPlugin().install(MainManager.pluginParameter);
                    new PanningButtonPlugin().install(MainManager.pluginParameter);
                    new AboutPlugin().install(MainManager.pluginParameter);
                    new GraphComparisonPlugin().install(MainManager.pluginParameter);
                    new GraphMLExporterPlugin().install(MainManager.pluginParameter);
                    new NavigatorPlugin().install(MainManager.pluginParameter);
                } catch (Throwable ex) {
                    System.err.println(ex.getMessage());
                }
            }
        });
	}
}
